﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Data.Linq.Mapping;
using System.ComponentModel;

namespace STS.Model
{
    [Table]
    public class Badania : INotifyPropertyChanged, INotifyPropertyChanging
    {
        private int id;

        [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
        public int Id
        {
            get { return id; }
            set
            {
                if (id != value)
                {
                    NotifyPropertyChanging("Id");
                    id = value;
                    NotifyPropertyChanged("Id");
                }
            }
        }

        private int idBadania;

        [Column]
        public int IdBadania
        {
            get { return idBadania; }
            set
            {
                if (idBadania != value)
                {
                    NotifyPropertyChanging("IdBadania");
                    idBadania = value;
                    NotifyPropertyChanged("IdBadania");
                }
            }
        }

        private string nazwaBadania;

        [Column]
        public string NazwaBadania
        {
            get { return nazwaBadania; }
            set
            {
                if (nazwaBadania != value)
                {
                    NotifyPropertyChanging("NazwaBadania");
                    nazwaBadania = value;
                    NotifyPropertyChanged("NazwaBadania");
                }
            }
        }

        private string opisBadania;

        [Column]
        public string OpisBadania
        {
            get { return opisBadania; }
            set
            {
                if (opisBadania != value)
                {
                    NotifyPropertyChanging("OpisBadania");
                    opisBadania = value;
                    NotifyPropertyChanged("OpisBadania");
                }
            }
        }

        private DateTime dataBadania;

        [Column]
        public DateTime DataBadania
        {
            get { return dataBadania; }
            set
            {
                if (dataBadania != value)
                {
                    NotifyPropertyChanging("DataBadania");
                    dataBadania = value;
                    NotifyPropertyChanged("DataBadania");
                }
            }
        }

        private int idLekarza;

        [Column]
        public int IdLekarza
        {
            get { return idLekarza; }
            set
            {
                if (idLekarza != value)
                {
                    NotifyPropertyChanging("IdLekarza");
                    idLekarza = value;
                    NotifyPropertyChanged("IdLekarza");
                }
            }
        }

        private int idPacjenta;

        [Column]
        public int IdPacjenta
        {
            get { return idPacjenta; }
            set
            {
                if (idPacjenta != value)
                {
                    NotifyPropertyChanging("IdPacjenta");
                    idPacjenta = value;
                    NotifyPropertyChanged("IdPacjenta");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public event PropertyChangingEventHandler PropertyChanging;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void NotifyPropertyChanging(string propertyName)
        {
            if (PropertyChanging != null)
            {
                PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
            }
        }

        public override string ToString()
        {
            return String.Format("Id: {0} IdTypLekarza: {2}", Id, IdBadania);
        }
    }
}
